import {NgModule, ErrorHandler} from '@angular/core';
import {IonicApp, IonicModule, IonicErrorHandler} from 'ionic-angular';
import {MyApp} from './app.component';
import {HomePage} from '../pages/home/home';
import {StoryPage} from '../pages/story/story';
import {MessageBoardPage} from '../pages/message-board/message-board';
import {PhotoPage} from '../pages/photo/photo';
import {SettingsPage} from '../pages/settings/settings';
import {TabsPage} from '../pages/tabs/tabs';
import {ReplyInput} from '../components/reply-input/reply-input';
import {ReplyList} from '../components/reply-list/reply-list';
import {EmojiPopoverPage} from '../components/emoji-popover/emoji-popover';
import {AddContentPage} from '../components/add-content/add-content';
import {Storage} from '@ionic/storage';
import {ContentCard} from "../components/content-card/content-card";
import {ImgList} from "../components/img-list/img-list";
import {PhotoViewerPage} from "../pages/photo-viewer/photo-viewer";
import {KeyboardAttachDirective} from "../utils/keyboard-attach";
import {Emoji} from "../components/emoji/emoji";
import {KeysPipeModule} from "../modules/pipes/KeysPipe";
import {ChunkPipeModule} from "../modules/pipes/ChunkPipe";
import {RichTextViewer} from "../components/rich-text-viewer/rich-text-viewer";
import {TextComponent} from "../components/text/text";
import {TimeLine} from "../components/time-line/time-line";
import {AppService} from "../services/AppService";
import {LoginPage} from "../pages/login/login";
import {AppHttpService} from "../services/AppHttpService";
import {EmojiService} from "../services/EmojiService";

export function provideStorage() {
  return new Storage({name: '__mydb'});
}

@NgModule({
  declarations: [
    MyApp,
    HomePage,
    StoryPage,
    MessageBoardPage,
    PhotoPage,
    SettingsPage,
    TabsPage,
    ReplyInput,
    ReplyList,
    EmojiPopoverPage,
    AddContentPage,
    ContentCard,
    ImgList,
    PhotoViewerPage,
    KeyboardAttachDirective,
    Emoji,
    RichTextViewer,
    TextComponent,
    TimeLine,
    LoginPage
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    KeysPipeModule,
    ChunkPipeModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    StoryPage,
    MessageBoardPage,
    PhotoPage,
    SettingsPage,
    TabsPage,
    ReplyInput,
    ReplyList,
    EmojiPopoverPage,
    AddContentPage,
    ContentCard,
    ImgList,
    PhotoViewerPage,
    Emoji,
    RichTextViewer,
    TextComponent,
    TimeLine,
    LoginPage
  ],
  providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}, {provide: Storage, useFactory: provideStorage}, AppService, AppHttpService, EmojiService]
})
export class AppModule {
}
